

package com.dog.basics.admin.controller.common;

import com.dog.basics.bean.dto.admin.common.AdminDogConnectFlowingFromDto;
import com.dog.basics.bean.vo.admin.common.AdminDogConnectFlowingHomeVo;
import com.dog.basics.bean.vo.admin.common.AdminDogConnectFlowingInfoVo;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.common.DogConnectFlowingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;


/**
 * 用户积分余额流水
 *
 * @author cy code generator
 * @date 2021-04-07 11:23:25
 */
@RestController
@AllArgsConstructor
@RequestMapping("/admin/dogconnectflowing")
@Api(value = "账户流水", tags = "账户流水")
public class DogConnectFlowingController {

    private final DogConnectFlowingService dogConnectFlowingService;

    /**
     * 分页查询
     *
     * @param page 分页对象
     * @param obj  用户积分余额流水
     * @return
     * @author cy code generator
     * @date 2021-04-07 11:23:25
     */
    @ApiOperation(value = "分页查询", notes = "admin_dogconnectflowing_view")
    @GetMapping("/page")
    @PreAuthorize("@pms.hasPermission('admin_dogconnectflowing_view')")
    public R<AdminDogConnectFlowingHomeVo> getDogConnectFlowingPage(PageParam page, AdminDogConnectFlowingFromDto obj) {
        return R.ok(dogConnectFlowingService.getAdminPageList(page, obj));
    }


    /**
     * 通过id查询用户积分余额流水
     *
     * @param id id
     * @return R
     * @author cy code generator
     * @date 2021-04-07 11:23:25
     */
    @ApiOperation(value = "通过id查询", notes = "admin_dogconnectflowing_info")
    @GetMapping("/{id}")
    @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "Long")
    @PreAuthorize("@pms.hasPermission('admin_dogconnectflowing_info')")
    @ApiIgnore
    public R<AdminDogConnectFlowingInfoVo> getById(@PathVariable("id") Long id) {
        return R.ok(dogConnectFlowingService.getAdminObjXq(id));
    }

    /**
     * 通过id删除用户积分余额流水
     *
     * @param id id
     * @return R
     * @author cy code generator
     * @date 2021-04-07 11:23:25
     */
    @ApiOperation(value = "通过id删除用户积分余额流水", notes = "admin_dogconnectflowing_del")
    @SysLog("通过id删除用户积分余额流水")
    @DeleteMapping("/{id}")
    @PreAuthorize("@pms.hasPermission('admin_dogconnectflowing_del')")
    @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "Long")
    @ApiIgnore
    public R<Boolean> removeById(@PathVariable Long id) {
        return R.ok(dogConnectFlowingService.deleteObj(id));
    }

}
